package top.kaoshanji.r3ch12a;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

/**
 * 代码清单-r4ch12a-393页a：定义一个服务类
 * @author kaoshanji
 * ^_^
 * create time 2025/5/9 17:16
 */
@Service("userService")
public class UserJdbcWithoutTransManagerService {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void addScore(String userName,int toAdd){
        String sql = " UPDATE t_user1 u SET u.score = u.score + ? WHERE user_name =? ";
        jdbcTemplate.update(sql,toAdd,userName);
    }


}
